package com.tsystems.tuni.sportplanet.entity;

// Generated Nov 28, 2012 7:14:09 PM by Hibernate Tools 3.4.0.CR1

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlTransient;

/**
 * Season Entity.
 * 
 * @author Yuriy Eremin
 * 
 */
@Entity
@Table(name = "season", catalog = "sportsplanet")
public class Season implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer seasonId;
	private String name;
	private Date year;
	private Set<Game> games = new HashSet<Game>(0);

	public Season() {
	}

	public Season(String name, Date year) {
		this.name = name;
		this.year = year;
	}

	public Season(String name, Date year, Set<Game> games) {
		this.name = name;
		this.year = year;
		this.games = games;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "season_id", unique = true, nullable = false)
	public Integer getSeasonId() {
		return this.seasonId;
	}

	public void setSeasonId(Integer seasonId) {
		this.seasonId = seasonId;
	}

	@Column(name = "name", nullable = false, length = 10)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "year", nullable = false, length = 0)
	public Date getYear() {
		return this.year;
	}

	public void setYear(Date year) {
		this.year = year;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "season")
	@XmlTransient
	public Set<Game> getGames() {
		return this.games;
	}

	public void setGames(Set<Game> games) {
		this.games = games;
	}

}
